home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / prodpack.zip / DB4PPSRC.EXE / _DLCCLAY.PRG < prev    next >
Text File  |  1993-05-06  |  5KB  |  193 lines

  1. PROCEDURE _DLCCLay
  2. PARAMETERS pcPanel, pcFile
  3. *----------------------------------------------------------------------------
  4. * NAME
  5. *   _DLCCLay - 
  6. *
  7. * DESCRIPTION
  8. *
  9. * PARAMETERS
  10. *   pcPanel    = 
  11. *   pcFile     = 
  12. *
  13. *----------------------------------------------------------------------------
  14.   PRIVATE ll_talk, ll_trap, ll_escape
  15.   ll_talk = _TalkMode( .F. )            && Save current TALK mode.
  16.   ll_trap = SET( "TRAP" ) = "ON"
  17.   SET TRAP OFF
  18.   ll_escape  = SET( "ESCAPE" ) = "ON"   && Save the ESCAPE state
  19.   SET ESCAPE OFF                        && Force ESCAPE OFF so prgs can't be stopped
  20.  
  21.   cDBBLib = "DBBDSGN"
  22.   IF .NOT. ( cDBBLib $ SET("LIBRARY") )
  23.     lError = .F.
  24.     ON ERROR lError = .T.
  25.     SET LIBRARY TO ( cDBBLib )
  26.     IF lError
  27.       lError = .F.
  28.       SET LIBRARY TO HOME() + cDBBLib
  29.       IF lError
  30.         DO _Err_Box WITH [DBB not installed correctly]
  31.         RETURN
  32.       ENDIF
  33.     ENDIF
  34.     ON ERROR
  35.   ENDIF
  36.  
  37.   FXL_NoChng = .F.
  38.  
  39.   PUBLIC ARRAY DLCCDEV[ 6 ]
  40.  
  41.   IF TYPE( "FXL_DEV" ) = "L" .AND. FXL_DEV
  42.     *-- CK_OPTI_1 - [ ] ~Developer mode
  43.     DLCCDEV[ 1 ]     = .F.
  44.   ELSE
  45.     RELEASE FXL_DEV
  46.     PUBLIC FXL_DEV
  47.     FXL_DEV = .F.
  48.     DLCCDEV[ 1 ]     = .T.
  49.   ENDIF
  50.  
  51.   IF TYPE( "DBW_HELP" ) = "C"
  52.     DLCCDEV[ 2 ]     = LEFT( DBW_HELP + SPACE( 8 ), 8 )
  53.   ELSE
  54.     *-- EF_HEFI_1 - XXXXXXXX
  55.     DLCCDEV[ 2 ]     = "DLGHELP" + SPACE( 1 )
  56.   ENDIF
  57.  
  58.   *-- BT_OK -    Ok
  59.   DLCCDEV[ 3 ]     = .T.
  60.   *-- BT_CANCEL -  Cancel
  61.   DLCCDEV[ 4 ]     = .F.
  62.   *-- BT_HELP -   ~Help
  63.   DLCCDEV[ 5 ]     = .F.
  64.  
  65.   FXL_Cancel = .F.
  66.   
  67.   DO DLCCDEV
  68.  
  69.   IF .NOT. FXL_Cancel                   && The user clicked on OK
  70.     RELEASE DBW_HELP, FXL_DEV
  71.     PUBLIC  DBW_HELP, FXL_DEV
  72.     IF DLCCDev[ 1 ]                     && Development mode
  73.       FXL_DEV = .T.
  74.     ENDIF
  75.     DBW_HELP = DLCCDev[ 2 ]             && Help file name
  76.   ENDIF
  77.  
  78.   *--------------------------
  79.   *-- Restore the environment
  80.   *--------------------------
  81.   RELEASE DLCCDEV
  82.   IF ll_trap
  83.     SET TRAP ON
  84.   ELSE
  85.     SET TRAP OFF
  86.   ENDIF
  87.   IF ll_escape
  88.     SET ESCAPE ON
  89.   ELSE
  90.     SET ESCAPE OFF
  91.   ENDIF
  92.   IF _TalkMode( ll_talk )
  93.   ENDIF
  94.  
  95. RETURN
  96. *-- EOP: _DLCCLay WITH pcPanel, pcFile
  97.  
  98.  
  99. PROCEDURE _Err_Box
  100. PARAMETERS pc_msg
  101. *----------------------------------------------------------------------------
  102. * NAME
  103. *   _Err_Box - Display an error box
  104. *
  105. * SYNOPSIS
  106. *   DO _Err_Box WITH <pc_msg>
  107. *
  108. * DESCRIPTION
  109. *   _Err_Box will display the <pc_msg> string in a box and prompt the
  110. *   user to press any key to continue processing.  _Err_Box will display
  111. *   the message based on the length of <pc_msg>.
  112. *
  113. * PARAMETERS
  114. *   pc_msg - the error message to display in the box.  If the length is
  115. *            greater than 76, the trailing part is chopped off.
  116. *
  117. * EXAMPLE
  118. *   DO _Err_Box WITH "Incorrect window size"
  119. *   Displays the message in a window as follows at row 9 on the screen:
  120. *                      +------------------------------+
  121. *                      |                              |
  122. *                      |    Incorrect window size     |
  123. *                      |                              |
  124. *                      | Press any key to continue... |
  125. *                      |                              |
  126. *                      +------------------------------+
  127. *   Note that the width of the window will increase to accommodate a longer
  128. *   message string.
  129. *
  130. * LIMITATIONS
  131. *   Truncates the message after 76 characters.  Assumes an 80 character
  132. *   wide screen.  Looks best with SET CURSOR OFF.
  133. *
  134. *----------------------------------------------------------------------------
  135.  
  136.   PRIVATE lc_anykey, lc_msg, lc_msglen, lc_win, ln_press, ln_width, ll_trap,;
  137.           ll_escape
  138.  
  139.   lc_anykey = [Press any key to continue...]
  140.   ln_press  = LEN( lc_anykey )
  141.   lc_win = WINDOW()                     && Currently activated window if any
  142.   lc_msg = LTRIM( RTRIM( pc_msg ) )     && Trimmed message
  143.   ln_msglen = LEN( lc_msg )             && Trimmed length of message
  144.   ln_width = 0                          && Width of display area in window.
  145.   ll_escape = SET("ESCAPE") = "ON"
  146.   IF TYPE( "FXL_DEV" ) = "L" .AND. FXL_DEV
  147.     SET ESCAPE ON
  148.   ELSE
  149.     SET ESCAPE OFF
  150.   ENDIF
  151.  
  152.   *-- Determine the width needed for the window:
  153.   IF ln_msglen <= ln_press
  154.     ln_width = ln_press
  155.   ELSE
  156.     *-- Make sure the message fits in the window:
  157.     IF ln_msglen > 76
  158.       lc_msg = LEFT( lc_msg, 76 )
  159.       ln_msglen = 76
  160.     ENDIF
  161.     ln_width = ln_msglen
  162.   ENDIF
  163.   DEFINE WINDOW _err_box FROM 9, ((76 - ln_width) + .5) / 2 ;
  164.                 TO 15, (ln_width + 83) / 2 DOUBLE
  165.   ln_width = ( ln_width + 2 )
  166.  
  167.   *-- Display the message and prompt to the window and wait for a key press
  168.   ACTIVATE WINDOW _err_box
  169.   @ 1, ( ln_width - ln_msglen ) / 2 SAY lc_msg
  170.   @ 3, ( ln_width - ln_press ) / 2 SAY lc_anykey
  171.   SET CONSOLE OFF                       && For mouse click recognition
  172.   WAIT
  173.   SET CONSOLE ON
  174.  
  175.   *-- Clean up the window display and reactivate the previous window
  176.   RELEASE WINDOW _err_box
  177.   IF ISBLANK( lc_win )
  178.     ACTIVATE SCREEN
  179.   ENDIF
  180.  
  181.   IF ll_escape
  182.     SET ESCAPE ON
  183.   ELSE
  184.     SET ESCAPE OFF
  185.   ENDIF
  186.  
  187. RETURN
  188. *-- EOP: _Err_Box WITH pc_msg
  189.  
  190.  
  191.  
  192. 
  193.